import 'package:flutter/material.dart';
import 'json.dart';
void main()=>runApp(MyApp());

class MyApp extends StatelessWidget{
  List<Widget> list = new List();

  Widget _listWidget(context,index){
      return Container(
        width: 100,
        height: 100,
        decoration: BoxDecoration(
          color: Colors.greenAccent,
          border: Border.all(
            color: Colors.grey,
            width: 1
          ),
        ),
        child: Column(

          children: <Widget>[
            Image.network(DataList[index]['image'],fit: BoxFit.cover,),
            SizedBox(height: 12,),
            Text("${DataList[index]['title']}"
            ,style: TextStyle(fontSize: 10),
            maxLines: 1,
            overflow: TextOverflow.ellipsis,
            textAlign: TextAlign.center,
            )
          ],
        ),
      );
  }
  Widget build(BuildContext context){
    return MaterialApp(
      home:Scaffold(
        appBar: AppBar(
          title: Text("data",
          textAlign: TextAlign.right,
          ),
        ),
        body: GridView.builder(
          padding: EdgeInsets.all(5),
          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
            crossAxisCount: 1,
            mainAxisSpacing: 10,
            crossAxisSpacing: 10,
            childAspectRatio:5/6
            
          ),
          itemCount: DataList.length,
          itemBuilder: this._listWidget,
        ),
      ),
    );
  }
}


